package com.twt.sys.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.twt.model.system.vo.SysParamsQueryVo;
import com.twt.sys.base.BaseController;
import com.twt.common.pojo.Result;
import com.twt.model.system.entity.SysParamsPo;
import com.twt.sys.base.BaseService;
import com.twt.sys.base.annotation.ValidateController;
import com.twt.sys.service.SysParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: 参数管理 控制层
 * @Author: TWT
 * @Date: 22:28 2022/6/16
 **/
@RestController
@RequestMapping("/sys/params")
public class SysParamsController extends BaseController<SysParamsPo> {
    @Autowired
    private SysParamService sysParamService;

    @Override
    protected BaseService getBaseService() {
        return sysParamService;
    }

    /**
     * @Description: 分页查询
     * @Author: TWT
     * @Date: 22:32 2022/6/16
     * @param:[currentPage, pageSize, queryVo]
     * @return:com.twt.common.pojo.Result
     **/
    @GetMapping("/query/page/{currentPage}/{pageSize}")
    public Result queryPageSysParams(@PathVariable("currentPage") long currentPage, @PathVariable("pageSize") long pageSize, SysParamsPo queryVo) {
        Page<SysParamsPo> page = new Page<>();
        page.setCurrent(currentPage);
        page.setSize(pageSize);

        Page<SysParamsPo> sysDictPage = this.sysParamService.queryPageByQueryVo(page, queryVo);
        return Result.ok(sysDictPage);
    }


}
